<template>
  <div class="block">
    <div class="flex">
      <div :class="false ? 'func-active' : 'func'" @click="handleIDManeger">
        <img src="../../assets/Simright.svg" alt="" class="icon" />
        <span class="func-name">重新编号</span>
      </div>
      <div class="fill"></div>
      <div :class="'func'" @click="changeMeasurementStatus">
        <img src="../../assets/celiang.svg" alt="" class="icon" />
        <span class="func-name">测量</span>
      </div>
      <div class="fill"></div>
      <div :class="'func'" @click="executeMask">
        <img src="../../assets/model_icon_hide.svg" alt="" class="icon" />
        <span class="func-name">隐藏选中面</span>
      </div>
      <div class="fill"></div>
      <div :class="'func'" @click="executeUnmask">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">取消隐藏面</span>
      </div>
      <div class="fill"></div>
      <div :class="'func'" @click="trimModalVueActiveBtn">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">修剪</span>
      </div>
      <div class="fill"></div>
      <div :class="'func'" @click="normalModalVueActiveBtn">
        <img src="../../assets/normal.svg" alt="" class="icon" />
        <span class="func-name">法向向量</span>
      </div>
      <div :class="'func'" @click="freeBodyModalVueActiveBtn">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">FreeBody功能卡</span>
      </div>
      <div :class="'func'" @click="collectionCardModalVueActiveBtn">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">集合卡片</span>
      </div>
      <div :class="'func'" @click="physicalFieldModalVueActiveBtn">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">物理场CSV 导入</span>
      </div>
      <div :class="'func'" @click="nameRuleActiveBtn">
        <img src="../../assets/model_icon.svg" alt="" class="icon" />
        <span class="func-name">命名规则</span>
      </div>
      <div :class="'func'" @click="findForceActiveBtn">
        <img src="../../assets/f.svg" alt="" class="icon" />
        <span class="func-name">通过网格找载荷</span>
      </div>
      <div :class="'func'" @click="organized">
        <img src="../../assets/f.svg" alt="" class="icon" />
        <span class="func-name">组织</span>
      </div>
    </div>
    <div class="title">工具</div>
    <IDManagerModal transfer></IDManagerModal>
    <TrimModal></TrimModal>
    <NormalModal></NormalModal>
    <FreeBodyCard></FreeBodyCard>
    <SetCollectionCard></SetCollectionCard>
    <PhysicalField></PhysicalField>
    <NameRuleModal></NameRuleModal>
  </div>
</template>
<script lang="ts" setup>
import { useCoreStore, _global } from "@/UI/store";
import { storeToRefs } from "pinia";
import IDManagerModal from "@/UI/components/ExtraTool/IDManagerModal.vue";
import TrimModal from "@/UI/components/trimModalVueActive.vue";
import NormalModal from "@/UI/components/normalVectorModalVueActive.vue";
import FreeBodyCard from "@/UI/components/freeBodyCard.vue";
import PhysicalField from "@/UI/components/physicalField.vue";
import SetCollectionCard from "@/UI/components/setCollectionCard.vue";
import NameRuleModal from "@/UI/views/modal/NameRuleModal.vue";
import { Message, Notice } from "cax-ui";
const coreStore = useCoreStore();
const { measureModule } = storeToRefs(coreStore);

function changeMeasurementStatus() {
  if (measureModule.value.on) {
    _global.Engine.registerNormalRightClick();
    coreStore.measureModuleOff();
    _global.Engine.measureComp.clearMeasureActors();
  } else {
    _global.Engine.unregisterNormalRightClick();
    coreStore.measureModuleOn();
  }
}

// 隐藏被选中的面
function executeMask() {
  _global.Engine.masker.mask();
}

// 取消隐藏面
function executeUnmask() {
  _global.Engine.masker.unmaskAll();
}
function handleIDManeger() {
  // coreStore.openIDManagerModal();
  // window.open(
  //   "http://47.100.101.102:49203/applications/3dlite/projects/p/wy/case1.vtk"
  // );
  coreStore.setreNumberActiveModal(true);
}
function trimModalVueActiveBtn() {
  coreStore.setTrimModalVueActive(true);
}
function normalModalVueActiveBtn() {
  coreStore.setNormalVectorModalVueActive(true);
}
function freeBodyModalVueActiveBtn() {
  coreStore.setFreeBodyModalVueActive(true);
}
function collectionCardModalVueActiveBtn() {
  coreStore.setCollectionCardModalVueActive(true);
}
function physicalFieldModalVueActiveBtn() {
  coreStore.setPhysicalFieldModalVueActive(true);
}
function nameRuleActiveBtn() {
  coreStore.setNameRuleVueActive(true);
}
function findForceActiveBtn() {
  _global.Engine.find.findLoadByElem().then((res) => {
    Notice.open(`Info: ${res} Loads were found.`);
    return res;
  });
}
function organized() {
  coreStore.setOrganizedVueActive(true);
}
</script>
<style lang="less" scoped>
@import "../../styles/xxxTool.less";
</style>
